#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

#define mm(a, n) memset(a, n, sizeof a)
#define mk(a, b) make_pair(a, b)

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int n;
string s;
double sum = 0;
int cnt = 0;

bool check(string s) {

    int point = 0;
    for (int i = 0; i < s.size(); i ++ ) {
        if (!(isdigit(s[i]) || s[i] == '.' || s[i] == '-')) return false; // 过滤其他字符

        if (s[i] == '-' && i != 0) return false;

        // 小数点前面必须是数字
        if (s[i] == '.') {
            if (i + 2 < (int)s.size() - 1) return false;
            if (i == 0 || !isdigit(s[i - 1])) return false;
            point ++ ;
            if (point >= 2) return false;
        }
    }
    double t = stod(s);
    return t >= -1000 && t <= 1000;
}


inline void solution() {
    cin >> n;
    for (int i = 0; i < n; i ++ ) {
        cin >> s;
        if (check(s)) {
            sum += stod(s);
            cnt ++ ;
        } else printf("ERROR: %s is not a legal number\n", s.c_str());
    }

    if (cnt == 0) {
        printf("The average of %d numbers is Undefined\n", cnt);
    } else if (cnt == 1) {
        printf("The average of 1 number is %.2lf\n", sum / cnt);
    } else {
        printf("The average of %d numbers is %.2lf\n", cnt, sum / cnt);
    }
}

int main() {
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}